package com.usaas.search.controller.app;

import com.usaas.common.core.domain.AjaxResult;
import com.usaas.search.component.AppTokenComponent;
import com.usaas.search.dto.PlatUserDto;
import com.usaas.search.dto.PlatUserFeedbackDto;
import com.usaas.search.interceptor.realnameauth.RealNameAuth;
import com.usaas.search.service.IPlatUserFeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户反馈Controller
 *
 * @author Helios
 * @date 2024-08-14
 */
@RestController
@RequestMapping("/app/search/platUserFeedback")
public class AppPlatUserFeedbackController extends AppBaseController {

    @Autowired
    private IPlatUserFeedbackService platUserFeedbackService;
    @Autowired
    private AppTokenComponent appTokenComponent;

    /**
     * 查询客户端用户基础信息分页列表
     */
//    @Log(title = "app端用户反馈page查询", businessType = BusinessType.OTHER,operatorType = OperatorType.MOBILE)
    @PostMapping("/page")
    public AjaxResult page(@RequestBody PlatUserFeedbackDto platUserFeedbackDto) {
        PlatUserDto userInfo = getUserInfo();
        platUserFeedbackDto.setUserId(userInfo.getId());
        return platUserFeedbackService.queryPage(platUserFeedbackDto);
    }

    /**
     * 获取用户反馈详细信息
     */
//    @Log(title = "app端用户反馈详细信息" , businessType = BusinessType.OTHER,operatorType = OperatorType.MOBILE)
    @PostMapping(value = "/getInfo")
    public AjaxResult getInfo(@RequestBody PlatUserFeedbackDto platUserFeedbackDto) {
        return AjaxResult.success(platUserFeedbackService.queryById(platUserFeedbackDto.getId()));
    }

    /**
     * 新增用户反馈
     */
//    @Log(title = "app端用户反馈新增" , businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE)
    @RealNameAuth
    @PostMapping(value = "/add")
    public AjaxResult add(@RequestBody PlatUserFeedbackDto platUserFeedbackDto) {
        PlatUserDto userInfo = getUserInfo();
        platUserFeedbackDto.setUserId(userInfo.getId());
        return toAjax(platUserFeedbackService.add(platUserFeedbackDto));
    }
//
//    /**
//     * 修改用户反馈
//     */
//    @Log(title = "app端用户反馈修改" , businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE)
//    @PostMapping(value = "/edit")
//    public AjaxResult edit(@RequestBody PlatUserFeedbackDto platUserFeedbackDto) {
//        return toAjax(platUserFeedbackService.update(platUserFeedbackDto));
//    }
//
//    /**
//     * 删除用户反馈
//     */
//    @Log(title = "app端用户反馈删除" , businessType = BusinessType.DELETE,operatorType = OperatorType.MOBILE)
//    @PostMapping("/del}" )
//    public AjaxResult del(@RequestBody PlatUserFeedbackDto platUserFeedbackDto) {
//        return toAjax(platUserFeedbackService.removeBatch(platUserFeedbackDto.getIds()));
//    }

}
